#include<stdio.h>
int main()
{
	int n,i,sum=0;
	while(1)
	{
		scanf("%d",&n);
		if(n==0)
			break;
		while(n--)
		{
			scanf("%d",&i);
			sum+=i;
		}
		printf("%d\n",sum);
		sum=0;
	}
	return 0;
}
